<?php
include_once("../modules/checkA.php");
include_once("../../config.php");
$plate=select_one_line_all_items($table_Prefix."plate","mid = 'inventory'");
?>



<?
//用来判断当前系统属于什么板块
$system_part = $plate['mid'];
?>
 
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php include_once(ROOT_PATH_.'/controlbase/modules/head.php'); ?>


	
</head>

<body>

<div id="topbar"><?php include ROOT_PATH_.'/controlbase/modules/topbar.php'; ?></div>

<div id="container" class="rental">

    <div id="maincontent">

        <div id="sidebar">
            <?php include ROOT_PATH_.'/controlbase/modules/sidebar.php'; ?>
        </div>


<div id="content"> 




<div class="box rental-add-box layui-form">
<h1>领取支出物资</h1>



<div class="tips">
    1.物料不在列表中，请先到物料管理系统中新增。
</div>

<form id="add-form" method="post" action="detail-add-reduce-function.php?nav-itemed=inventory" enctype="multipart/form-data" class="layui-form">

    <? $material_list=select_lines_all_items($table_Prefix."material","","" )?>

    <div class="layui-form-item">
        <label class="layui-form-label">物料</label>
        <div class="layui-input-block">
            <select name="materialnid" lay-search="" lay-verify="required">
                <option value="">直接输入关键词可以进行快速选择</option>
                <? for($i=0;$i<count($material_list);$i++){ ?>
                    <option value="<? echo $material_list[$i]['nid'] ?>"><? echo $material_list[$i]['name'] ?> ( <?echo $material_sum=sum_total($table_Prefix."inventory","number"," materialnid = '".$material_list[$i]['nid']."'");?> )</option>
                <? } ?>
            </select>
        </div>
    </div>



    <div class="layui-form-item">
        <label class="layui-form-label">日期</label>
        <div class="layui-input-block">
            <input type="text" name="applydate" id="date" autocomplete="off" class="layui-input"  value="<?echo date('Y-m-d')?>" onclick="laydate({istime: true, format: 'YYYY-MM-DD'})" class="laydate-icon">
        </div>
    </div>




    <div class="layui-form-item">
        <label class="layui-form-label">数量</label>
        <div class="layui-input-block">
            <input type="text" name="number" lay-verify="required" placeholder="请输入数量(正负数均计算为正数)" autocomplete="off" class="layui-input">
        </div>
    </div>



    <?
    $employee_list=select_lines_all_items($table_Prefix."employee","nid desc","","0");

    ?>

    <div class="layui-form-item">
        <label class="layui-form-label">处理人</label>
        <div class="layui-input-block">
            <select name="people" lay-search=""   lay-verify="required">
                <option value="<?echo $_SESSION['nid']?>"><?echo $_SESSION['username']?></option>

                <? for($i=0;$i<count($employee_list);$i++){ ?>
                    <option value="<? echo $employee_list[$i]['nid'] ?>"><? echo $employee_list[$i]['nid'] ?> : <? echo $employee_list[$i]['name'] ?></option>
                <? } ?>
            </select>
        </div>
    </div>



    <?
    $department_list=select_lines_all_items($table_Prefix."department","nid desc","","0");
    $department=select_one_line_all_items($table_Prefix."department","nid = '".$_SESSION['departmentid']."'");
    ?>

    <div class="layui-form-item">
        <label class="layui-form-label">部门</label>
        <div class="layui-input-block">
            <select name="department" >

                    <option value="<?echo $_SESSION['departmentid']?>"><?echo $department['name']?></option>

                <? for($i=0;$i<count($department_list);$i++){ ?>
                    <option value="<? echo $department_list[$i]['nid'] ?>"><? echo $department_list[$i]['nid'] ?> : <? echo $department_list[$i]['name'] ?></option>
                <? } ?>
            </select>
        </div>
    </div>




    <div class="layui-form-item">
        <label class="layui-form-label">签名</label>
        <div class="layui-input-block">
            <style>
                #closequanping{
                    display: none;
                    position: fixed;
                    top: 20px;
                    z-index: 101;
                    right: 20px;
                    font-size: 50px;
                    border: 5px solid #888;
                    border-radius: 50px;
                    height: 80px;
                    width: 80px;

                }
            </style>
            <button type="button" class="layui-btn" id="quanping">点击打开全屏签名</button>
            <button type="button" class="layui-btn" id="closequanping">X</button>

            <canvas id="can" width="500" height="300" style="border:1px solid #CCCCCC;clear: both;float: left;">签名板</canvas>

            <input type="hidden" value="" name="data" id="signup">


            <script>
                var canvas = $('#can'),//获取canvas元素
                    pan = canvas[0].getContext("2d"),//获取2D图像API接口
                    paint = false,//鼠标左键是否在画板区域按下
                    x,
                    y;
                pan.strokeStyle = "#000000";//设置画笔颜色
                pan.lineJoin = "round";//设置画笔轨迹基于圆点拼接







                $("#quanping").click(function(){
                    var realheight = window.innerHeight;
                    var realwidth = window.innerWidth;

                    $("#can").css({"position":"fixed","z-index":"100","background-color":"#ffffff","top":"0","left":"0","width":"","height":""});
                    $("#closequanping").css("display","block");

                    //重新设置画布图像大小
                    can.setAttribute("width",realwidth);
                    can.setAttribute("height",realheight);


                    pan.lineWidth = 15;//设置画笔粗细
                    //监控画板上的鼠标左键按下
                    canvas.mousedown(function(e){
                        paint = true;
                        x = e.offsetX;
                        y = e.offsetY;
                        pan.beginPath();
                        pan.moveTo(x,y);
                    });
                    //移动鼠标
                    canvas.mousemove(function(e){
                        if(paint) {
                            var nx = e.offsetX,
                                ny = e.offsetY;
                            pan.lineTo(x, y);
                            pan.stroke();
                            x = nx;
                            y = ny;
                        }
                    });
                    //释放鼠标左键
                    canvas.mouseup(function(e){
                        paint = false;
                    });
                    //鼠标离开画板
                    canvas.mouseleave(function(e){
                        paint = false;
                    });
                });
                $("#closequanping").click(function(){
                    $("#closequanping").css("display","none");
                    $("#can").css({"position":"relative","z-index":" ","background-color":" ","top":" ","left":" "});

                    var width=can.getAttribute("width");
                    var height=can.getAttribute("height");
                    //获取画布的图像信息,一个副本
                    var data=pan.getImageData(0,0,width,height);

                    //重新设置画布图像大小
                    $("#can").css({
                        "width": "500",
                        "height": "300"
                    });
                    //将获得的图像副本,重新绘制到画布,完成画布的大小改变
                    pan.putImageData(data,0,0);


                    //取消画布功能
                    canvas.mousedown(function(){
                        paint = false;
                    });
                    //移动鼠标
                    canvas.mousemove(function(){

                    });
                    //释放鼠标左键
                    canvas.mouseup(function(){
                        paint = false;
                    });
                    //鼠标离开画板
                    canvas.mouseleave(function(){
                        paint = false;
                    });
                });

                //提交数据处理
                $('form').submit(function() {
                    var data = canvas[0].toDataURL("image/png");//把canvas画板上的内容转成指定格式图片数据，并进行Base64编码
                    $('#signup').val(data);
                });



            </script>

        </div>
    </div>





    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">备注</label>
        <div class="layui-input-block">
            <textarea name="remark" placeholder="备注" class="layui-textarea"></textarea>
        </div>
    </div>




        <input name="equipmentid" type="hidden" value="<? echo $_REQUEST['equipmentid'] ?>"/>
        <input name="sys_part" type="hidden" value="<? echo $system_part ?>"/>
        <input name="nowpageid" type="hidden" value="<? echo $_REQUEST['nowpageid'] ?>"/>
        <input name="sortby" type="hidden" value="<? echo $_REQUEST['sortby'] ?>"/>










        <div class="layui-form-item">
    <div class="layui-input-block">
      <button class="layui-btn" lay-submit lay-filter="formrentalAdd" type="submit">立即提交</button>
      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
  </div>
</form>
 


 
 
        </div>
		
 
 
<!--content端點01-->
</div>
<!--maincontent端點01-->
<br class="clearfloat"/>
</div>
<!--container端點01-->
</div>








<?php include_once('../modules/footer.php'); ?> </body>
</html>
